package com.julang.check.config;

import com.julang.check.api.mapper.UserMapper;
import com.julang.check.interceptor.AliPayInterceptor;
import com.julang.check.interceptor.AuthenticationInterceptor;
import com.julang.check.interceptor.WxPayInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author 赵自强
 * */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Resource
    private UserMapper userMapper;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthenticationInterceptor(userMapper)).addPathPatterns("/**");
        registry.addInterceptor(new AliPayInterceptor()).addPathPatterns("/api/alipay/**");
        registry.addInterceptor(new WxPayInterceptor()).addPathPatterns("/api/wxpay/**", "/api/wxsubpay/**");
    }


}
